FROM centos:7
RUN useradd --base-dir /home/kingbase --home-dir /home/kingbase --no-create-home --user-group kingbase
COPY --chown=kingbase:kingbase ./setup-dir /opt/kingbase-setup
RUN chmod +x /opt/kingbase-setup/setup.sh && mkdir /opt/kingbase && chown kingbase:kingbase -R /opt/kingbase && cp /opt/kingbase-setup/license.dat /opt/kingbase/license.dat && cp /opt/kingbase-setup/docker-entrypoint.sh /opt/kingbase/docker-entrypoint.sh && chmod +x /opt/kingbase/docker-entrypoint.sh && cp /opt/kingbase-setup/pwfile /opt/kingbase/pwfile && chmod 444 /opt/kingbase/pwfile
USER kingbase
RUN /bin/bash /opt/kingbase-setup/setup.sh -i silent -f /opt/kingbase-setup/installer.properties
USER root
RUN rm -rf /opt/kingbase-setup
VOLUME /opt/kingbase
EXPOSE 54321
USER kingbase
ENTRYPOINT ["/opt/kingbase/docker-entrypoint.sh"]
